package com.zhuiyi.yiqingbackend.domain;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


/**
 * 两种方式获得配置文件的数据（属性值）
 */
@Data
//2.注入
//启动类用@EnableConfigurationProperties(value = DbEntity.class)
//或@Component
//1.标记 @ConfigurationProperties(prefix = "spring.datasource")

//2.注入
@Component
public class DbEntity {
//    1.标记
    @Value(value = "${spring.datasource.url}")
    private String url;
    @Value(value = "${spring.datasource.driver-class-name}")
    private String driverClassName;
    @Value(value = "${spring.datasource.username}")
    private String username;
    @Value(value = "${spring.datasource.password}")
    private String password;
}
